const pkg = require('./package.json');

const LIBS = [
    'react', 'react-dom', 'react-router', 'react-apollo', 'apollo-client'
];

const src = {
    dir: 'src',
    app: {
        dir: 'app'
    },
    etc: {
        dir: 'etc'
    },
    web: {
        dir: 'web',
        main: 'index.js'
    },
    css: {
        dir: 'css',
        main: 'index.css'
    },
    res: {
        dir: 'res'
    }
};

const dev = {
    dir: 'dev'
};

const test = {
    dir: 'test'
};

const bin = {
    dir: 'bin',
    web: {
        dir: 'www',
        main: 'bundle.js'
    },
    lib: {
        main: 'vendor.js',
        files: LIBS
    },
    css: {
        main: 'bundle.css'
    },
    tmp: {
        dir: 'tmp'
    }
};

module.exports = {
    args: ['-c'],
    name: pkg.name,
    main: pkg.main,
    src, dev, bin, test
};

const g = require('gulp');

['base', 'test', 'copy', 'zip'].forEach(file => {
    require(`./dev/gulp.${file}`);
});

g.task('copy', ['copy.all', 'copy.3rd']);

g.task('pub.build', [
    'copy', 'less', 'bower', 'build', 'webpack'
]);

g.task('default', [
    'copy', 'less', 'bower',
    'debug', 'webpack.debug', 'watch'
]);
